package com.star.modules.sys.api;

import com.jeesite.common.idgen.IdGenerate;
import com.star.modules.sys.base.BizDataResult;
import com.star.modules.sys.entity.ShMessage;
import com.star.modules.sys.enums.IfEnum;
import com.star.modules.sys.enums.ResultEnum;
import com.star.modules.sys.service.ShMessageService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

/**
 * 首页接口类
 */
@RestController
@RequestMapping(value = "${frontPath}/sys/msg")
public class MessageController {

    @Autowired
    private ShMessageService shMessageService;
    /**
     * 首页展示信息
     * @return
     */
    @RequestMapping(value = "send",method = RequestMethod.POST)
    public BizDataResult saveMsg(@RequestBody ShMessage shMessage){
        shMessage.setAsNews(IfEnum.FALSE.getCode());
        shMessageService.save(shMessage);
        return BizDataResult.createResult(ResultEnum.SUCCESS.getCode(),ResultEnum.SUCCESS.getMsg());
    }
}
